﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="insert_product.aspx.cs" Inherits="NKD07.Admin.add_product" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
<asp:Panel ID="Panel1" runat="server" Width="100%" HorizontalAlign="Left">
    <asp:Panel ID="Panel2" runat="server" Width="15%"  style="float:left; margin-left:5%">
            <asp:Label ID="ten" runat="server" Text="CATEGORIES" Width="100%" Font-Size="Large"></asp:Label>
            <asp:Panel ID="Panel3" runat="server" width="100%" HorizontalAlign="Center" style="margin-top:20px">
                <asp:DataList ID="dlCaregories" runat="server" Width="100%" BackColor="White" 
                    BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="10" 
                    ForeColor="Black" GridLines="Horizontal" CellSpacing="10">
                    <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
                    <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
                    <ItemTemplate>
                        <asp:Panel ID="Panel1" runat="server" HorizontalAlign="Left" Width="100%" style="padding:10px 0px 10px 0px">
                            <asp:HyperLink ID="hplCategory" runat="server" Font-Bold="True" 
                                Text='<%# Eval("name") %>' NavigateUrl='<%# this.ResolveUrl("manage_product.aspx?categoryID=" + String.Format("{0}",Eval("id")))%>' Font-Underline="False">
                            </asp:HyperLink>
                        </asp:Panel>
                    </ItemTemplate>
                    <SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
                </asp:DataList>
            </asp:Panel>
        </asp:Panel>

        <asp:Panel ID="Panel4" runat="server" Width="74%" HorizontalAlign="Left" style="float:left; margin-left:50px;">
            <asp:Label ID="Label1" runat="server" Text="INSERT NEW PRODUCT" Width="100%" Font-Size="Large"></asp:Label>
            <asp:DetailsView ID="dlProductInfo" runat="server" Height="50px" Width="100%" 
                style="margin-top:20px" AutoGenerateRows="False" BackColor="White" 
                BorderColor="#CC9966" BorderStyle="Outset" BorderWidth="1px" CellPadding="4" 
                EnableModelValidation="True">
                
                <EditRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                <Fields>
                    <asp:TemplateField HeaderText="Name">
                        <ItemTemplate>
                            <asp:TextBox ID="txtName" runat="server" Width="68%" MaxLength="50"
                            style="margin:10px 0px 10px 10px" Font-Bold="True" ForeColor="Black"></asp:TextBox>
                            <br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="txtName" Display="Dynamic" 
                                ErrorMessage="Name of product is required" 
                                style="margin:10px 0px 10px 10px" Font-Bold="False" Font-Italic="True" 
                                ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Description">
                        <ItemTemplate>
                            <asp:TextBox ID="txtDescription" runat="server" Width="70%" Height="97px" 
                                MaxLength="200" TextMode="MultiLine" style="margin:10px 0px 10px 10px" 
                                Font-Bold="True" ForeColor="Black"></asp:TextBox>
                                <br />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                ControlToValidate="txtDescription" Display="Dynamic" 
                                ErrorMessage="Description of product is required" 
                                style="margin:10px 0px 10px 10px" Font-Bold="False"
                                Font-Italic="True" ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Category">
                        <ItemTemplate>
                            <asp:DropDownList ID="ddlCategory" runat="server" Font-Bold="True" 
                                ForeColor="Black" Height="30px" Width="70%" style="margin:10px 0px 10px 10px">
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Stock">
                        <ItemTemplate>
                            <asp:TextBox ID="txtStock" MaxLength="6" runat="server" Width="68%" Text='<%# Eval("init") %>'
                            style="margin:10px 0px 10px 10px" Font-Bold="True" ForeColor="Black"></asp:TextBox>
                            <br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                ControlToValidate="txtStock" Display="Dynamic" 
                                ErrorMessage="Stock of product is required" 
                                style="margin:10px 0px 10px 10px" Font-Bold="False"
                                Font-Italic="True" ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ErrorMessage="Stock of product must be number" Font-Italic="True" style="margin:10px 0px 10px 10px" 
                                ControlToValidate="txtStock" ValidationExpression="^\d+$" ValidationGroup="updateInfoGroup"></asp:RegularExpressionValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Number Like">
                        <ItemTemplate>
                            <asp:TextBox ID="txtNumberLike" MaxLength="6" runat="server" Width="68%" Text='<%# Eval("init") %>'
                            style="margin:10px 0px 10px 10px" Font-Bold="True" ForeColor="Black"></asp:TextBox>
                            <br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ControlToValidate="txtNumberLike" Display="Dynamic" 
                                ErrorMessage="Number Like is required"
                                style="margin:10px 0px 10px 10px" Font-Bold="False"
                                Font-Italic="True" ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                ErrorMessage="Numer Like must be number" Font-Italic="True" style="margin:10px 0px 10px 10px" 
                                ControlToValidate="txtNumberLike" ValidationExpression="^\d+$" ValidationGroup="updateInfoGroup"></asp:RegularExpressionValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Number Dislike">
                        <ItemTemplate>
                            <asp:TextBox ID="txtNumberDislike" MaxLength="6" runat="server" Width="68%" Text='<%# Eval("init") %>'
                            style="margin:10px 0px 10px 10px" Font-Bold="True" ForeColor="Black"></asp:TextBox>
                            <br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                ControlToValidate="txtNumberDislike" Display="Dynamic" 
                                ErrorMessage="Number Dislike is required" 
                                style="margin:10px 0px 10px 10px" Font-Bold="False"
                                Font-Italic="True" ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                                ErrorMessage="Number Dislike must be number" Font-Italic="True" style="margin:10px 0px 10px 10px" 
                                ControlToValidate="txtNumberDislike" ValidationExpression="^\d+$" ValidationGroup="updateInfoGroup"></asp:RegularExpressionValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Price Sell">
                        <ItemTemplate>
                            <asp:TextBox ID="txtPriceSell" runat="server" MaxLength="8" Width="68%"  Text='<%# Eval("init") %>'
                            style="margin:10px 0px 10px 10px" Font-Bold="True" ForeColor="Black"></asp:TextBox>
                            <br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                                ControlToValidate="txtPriceSell" Display="Dynamic" 
                                ErrorMessage="Price Sell of product is required" 
                                style="margin:10px 0px 10px 10px" Font-Bold="False"
                                Font-Italic="True" ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                                ErrorMessage="Price Sell of product must be number" Font-Italic="True" style="margin:10px 0px 10px 10px"
                                ControlToValidate="txtPriceSell" ValidationExpression="^\d+$" ValidationGroup="updateInfoGroup"></asp:RegularExpressionValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Date Added">
                        <ItemTemplate>
                            <asp:Panel runat="server">
                                <asp:TextBox ID="txtDateAdded" runat="server" style="margin:10px 0px 10px 10px; float:left" 
                                Font-Bold="True" ForeColor="Black" ReadOnly="true"></asp:TextBox>
                                <asp:ImageButton ID="imgbtnDateAdded" ImageUrl="~/images/calendar_icon.png" runat="server" 
                                style="margin:5px 0px 10px 5px; float:left" />
                            </asp:Panel>
                            <ajaxToolkit:ToolkitScriptManager ID="tkmanager" runat="server"></ajaxToolkit:ToolkitScriptManager>
                            <ajaxToolkit:CalendarExtender ID="cldDateAdded" TargetControlID="txtDateAdded" runat="server" 
                            PopupButtonID="imgbtnDateAdded" Format="dd/MM/yyyy"></ajaxToolkit:CalendarExtender>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Publisher">
                        <ItemTemplate>
                            <asp:DropDownList ID="ddlPublisher" runat="server" Font-Bold="True" 
                                ForeColor="Black" Height="30px" Width="70%" style="margin:10px 0px 10px 10px">
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Mapping">
                        <ItemTemplate>
                            <asp:TextBox ID="txtMapping" runat="server" Width="68%" MaxLength="50"
                            style="margin:10px 0px 10px 10px" Font-Bold="True" ForeColor="Black"></asp:TextBox>
                            <br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                                ControlToValidate="txtMapping" Display="Dynamic" 
                                ErrorMessage="Information of mapping of product is required" 
                                style="margin:10px 0px 10px 10px" Font-Bold="False" 
                                Font-Italic="True" ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Picture">
                        <ItemTemplate>
                            <asp:FileUpload ID="fuProductImage" runat="server" style="margin:10px 0px 10px 10px" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                                ControlToValidate="fuProductImage" Display="Dynamic" 
                                ErrorMessage="not select image of product to upload " 
                                style="margin:10px 0px 10px 10px" Font-Bold="False" 
                                Font-Italic="True" ValidationGroup="updateInfoGroup"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                                ErrorMessage="the file type isn't right...[png, jpg, gif]" Font-Italic="True" style="margin:10px 0px 10px 10px"
                                ControlToValidate="fuProductImage" ValidationExpression="^.*\.(jpg|JPG|gif|GIF|png|PNG)$" ValidationGroup="updateInfoGroup">
                                </asp:RegularExpressionValidator>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                    </asp:TemplateField>
                </Fields>
                <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" 
                    HorizontalAlign="Center" VerticalAlign="Middle" />
                <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                <RowStyle BackColor="White" ForeColor="#330099" />
            </asp:DetailsView>
            <asp:Button ID="btnInsert" runat="server" Text="Insert" Height="35px" Width="100px" 
                style="margin:20px 0 0 40%" Font-Bold="True" ForeColor="Black" 
                onclick="btnInsert_Click" ValidationGroup="updateInfoGroup" UseSubmitBehavior="True" />
        </asp:Panel>
</asp:Panel>
</asp:Content>
